//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.data.biz.utils.pageLimit;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class PageLimitHolderFilter implements Filter {
    private static final ThreadLocal<PageLimit> threadLocal = new ThreadLocal();

    public PageLimitHolderFilter() {
    }



    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        try {
            threadLocal.set(new PageLimit((HttpServletRequest)request));
            chain.doFilter(request, response);
        } finally {
            threadLocal.set(null);
        }

    }

    public static PageLimit getContext() {
        return (PageLimit)threadLocal.get();
    }

    public static void setContext(Integer currentPageNo, Integer pageLength, Integer totalCount) {
        threadLocal.set(new PageLimit(currentPageNo, pageLength, totalCount));
    }

    public void init(FilterConfig filterConfig) throws ServletException {
    }

    public void destroy() {
    }
}
